<?php

namespace common\models\base;

use Yii;

/**
 * This is the model class for table "{{%menu}}".
 *
 * @property string $id
 * @property string $parent_id
 * @property string $name
 * @property string $icon
 * @property integer $child
 * @property string $parent_arr
 * @property string $child_arr
 * @property string $controller
 * @property string $action
 * @property string $params
 * @property string $auth_item
 * @property integer $status
 */
class Menu extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%menu}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['parent_id', 'child', 'status'], 'integer'],
            [['name'], 'required'],
            [['child_arr'], 'string'],
            [['name', 'icon', 'controller', 'action'], 'string', 'max' => 30],
            [['parent_arr', 'params'], 'string', 'max' => 255],
            [['auth_item'], 'string', 'max' => 64],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => '菜单 ID',
            'parent_id' => '父级',
            'name' => '名称',
            'icon' => '图标',
            'child' => '有子级',
            'parent_arr' => '父级链',
            'child_arr' => '子级群',
            'controller' => '控制器',
            'action' => '方法',
            'params' => '参数',
            'auth_item' => '验证密钥',
            'status' => '状态',
        ];
    }
}
